package player_event

import (
	"errors"
	"fmt"
)

type (
	onLoginEvent struct {
	}
	onLoginCallback = func()
)

var OnLogin = new(onLoginEvent)

func (event *onLoginEvent) Verify(callback interface{}) (err error) {
	if _, ok := callback.(onLoginCallback); !ok {
		err = errors.New("not on login event callback function")
	}

	return
}

func (event *onLoginEvent) Call(callback interface{}, args []interface{}) (err error) {
	const ArgsCount = 0
	if len(args) < ArgsCount {
		err = fmt.Errorf("on login event callback need %d arg", ArgsCount)
		return
	}

	call := callback.(onLoginCallback)
	call()

	return
}
